package org.rency.mq.activemq.listener.factory;

import org.rency.mq.activemq.listener.handler.impl.AbstractHandler;

public class DefaultMessageListenerContainer extends AbstractMessageListenerContainer implements MessageListenerContainer {

	@Override
	public void initMessageListener() {
		DefaultMessageListener messageListener = null;
		if(isSessionAware()){
            messageListener = new DefaultSessionAwareMessageListener();
        }else{
            messageListener = new DefaultMessageListener();
        }
		AbstractHandler messageHandler = (AbstractHandler)getMessageHandler();
		messageListener.setMessageHandler(messageHandler);
		
		if(messageHandler.getConcurrentConsumers() > 1)
		setConcurrentConsumers(messageHandler.getConcurrentConsumers());
		setMessageListener(messageListener);
	}

}
